import type {
  ElTable,
  ElTableColumn,
  ElButton,
  ElSwitch,
  ElInput,
  ElTag,
} from 'element-plus';
// import type { enums } from '~/enum/index.enum';

type ButtonGroup = Partial<InstanceType<typeof ElButton>> & {
  label: string;
  click?: (row: any, index?: number) => void;
  permissions?: string;
  status?: string;
  statusName?: string[];
};
type switchProps = Partial<InstanceType<typeof ElSwitch>> & {
  onChange: (row: any) => void;
};
type inputProps = Partial<InstanceType<typeof ElInput>> & {
  onChange: (row: any) => void;
};
type MyFunctionType = (param: any) => {
  label: string;
  action?: string;
  permissions?: string;
  click?: (row: any, index?: number) => void;
}[];
export type TableColumn<T = string> = {
  prop?: T;
  label?: string;
  unit?: string;
  width?: number;
  fixed?: 'left' | 'right';
  children?: TableColumn[]; // 添加这一行
  type?:
    | 'text'
    | 'enum'
    | 'date'
    | 'datetime'
    | 'slot'
    | 'action'
    | 'switch'
    | 'image'
    | 'tag'
    | 'icon'
    | 'selection'
    | 'expand'
    | 'html'
    | 'img'
    | 'input'
    | 'copy'
    | 'progressBar'
    | 'boolean';
  enum?: {
    types: {
      type: Partial<InstanceType<typeof ElTag>>['type'];
      value: string;
    }[];
  };
  buttonGroup?: ButtonGroup[] | MyFunctionType;
  switchProps?: switchProps;
  inputProps?: inputProps;
  componentProps?: Partial<InstanceType<typeof ElTableColumn>>;
};

export type TableProps = Partial<InstanceType<typeof ElTable>>;
